import {ref} from "vue";

export const items: any = ref([
    {value:"ACTIVE", name:"活跃", show_type:"success"},
    {value:"FREEZE", name:"冻结", show_type:"danger"},
]);

export const get = function(value: string){
    for (let i=0; i<items.value.length; i++){
        if(items.value[i]?.value === value){
            return items.value[i];
        }
    }
    return null;
}

export const render = function(value: string){
    let data = get(value);
    if(data){
        return `<span class="badge bg-${data.show_type}">${data.name}</span>`;
    } else {
        return `<span class="badge bg-info">未知</span>`;
    }
}

export const refresh = function(){

}